home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Devil's Cubes 1.0.1 / source / Devil’s Cubes ƒ / MSG Shell ƒ / msg environment.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.6 KB  |  102 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        msg environment.c
  4.  
  5. Purpose:    This module handles initializing the environment and
  6.             checking for various environmental characteristics.
  7.  
  8.  
  9. Devil’s Cubes -- a simple cubes puzzle
  10. Copyright (C) 1993 Mark Pilgrim
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "GestaltEqu.h"
  30. #include "msg environment.h"
  31. #include "msg apple events.h"
  32. #include "msg graphics.h"
  33. #include "msg menus.h"
  34.  
  35. Boolean            gHasAppleEvents;
  36. Boolean            gHasFSSpecs;
  37. Boolean            gStandardFile58;
  38. Boolean            gHasColorQD;
  39. Boolean            gDone;
  40. Rect            gDragRect;
  41.  
  42. void CheckEnvironment(void)
  43. {
  44.     long    gestalt_temp;
  45.     OSErr    isHuman;
  46.     
  47.     isHuman = Gestalt(gestaltQuickdrawVersion, &gestalt_temp);
  48.     gHasColorQD = !(isHuman || (gestalt_temp < gestalt8BitQD));
  49.     
  50.     GetMainScreenBounds();
  51.     
  52.     isHuman = Gestalt(gestaltFSAttr, &gestalt_temp);
  53.     gHasFSSpecs=((isHuman==noErr) && (gestalt_temp & (1 << gestaltHasFSSpecCalls)));
  54.  
  55.     isHuman = Gestalt(gestaltStandardFileAttr, &gestalt_temp);
  56.     gStandardFile58=((isHuman==noErr) && (gestalt_temp & (1 << gestaltStandardFile58)));
  57.  
  58.     gHasAppleEvents=0;
  59.     isHuman = Gestalt(gestaltAppleEventsAttr, &gestalt_temp);
  60.     if(!isHuman) {
  61.         gHasAppleEvents = 1;
  62.         SetUpAppleEvents();
  63.     }
  64. }
  65.  
  66. void InitEnvironment(void)
  67. {
  68.     Handle        MBARHandle;
  69.     int            i;
  70.     
  71.     gHelpHeight=200;
  72.     gHelpWidth=300;
  73.     
  74.     for (i=0; i<NUM_HELP; i++)
  75.         gHelp[i]=0L;
  76.     
  77.     gMainWindow = 0L;
  78.     gInitedWindowBounds = 0;
  79.     
  80.     MBARHandle = GetNewMBar(400);
  81.     SetMenuBar(MBARHandle);
  82.     gAppleMenu = GetMHandle(appleMenu);
  83.     gFileMenu = GetMHandle(fileMenu);
  84.     gEditMenu = GetMHandle(editMenu);
  85.     gOptionsMenu = GetMHandle(optionsMenu);
  86.  
  87.     gHelpMenu = GetMenu(helpMenu);
  88.     InsertMenu(gHelpMenu, -1);
  89.     
  90.     AddResMenu(gAppleMenu, 'DRVR');
  91.     AdjustMenus();
  92.     DrawMenuBar();
  93.     
  94.     gDragRect = screenBits.bounds;
  95.     gDragRect.top += 4;
  96.     gDragRect.left += 4;
  97.     gDragRect.right -= 4;
  98.     gDragRect.bottom -= 4;
  99.     
  100.     gDone=FALSE;
  101. }
  102.